package entities;

import java.io.Serializable;

import javax.persistence.*;

/**
 * The persistent class for the medicine_detail database table.
 * 
 */
@Entity
@Table(name = "medicine_detail")
public class MedicineDetail implements Serializable {
	private static final long serialVersionUID = 1L;
	private int idMedicineDetail;
	private String dose;
	private MedicineInfo medicineInfo;
	private int quantity;
	private ExamineDetail examineDetail;

	public MedicineDetail() {
	}

	public MedicineDetail(String dose, MedicineInfo medicineInfo, int quantity,
			ExamineDetail examineDetail) {
		super();
		this.dose = dose;
		this.medicineInfo = medicineInfo;
		this.quantity = quantity;
		this.examineDetail = examineDetail;
	}

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(unique = true, nullable = false)
	public int getIdMedicineDetail() {
		return this.idMedicineDetail;
	}

	public void setIdMedicineDetail(int idMedicineDetail) {
		this.idMedicineDetail = idMedicineDetail;
	}

	@Column(nullable = false, length = 100)
	public String getDose() {
		return this.dose;
	}

	public void setDose(String dose) {
		this.dose = dose;
	}

	@ManyToOne
	@JoinColumn(name = "idMedicineInfo", nullable = false)
	public MedicineInfo getMedicineInfo() {
		return medicineInfo;
	}

	public void setMedicineInfo(MedicineInfo medicineInfo) {
		this.medicineInfo = medicineInfo;
	}

	@Column(nullable = false)
	public int getQuantity() {
		return this.quantity;
	}

	public void setQuantity(int quantity) {
		this.quantity = quantity;
	}

	// bi-directional many-to-one association to ExamineDetail
	@ManyToOne
	@JoinColumn(name = "idExamine", nullable = false)
	public ExamineDetail getExamineDetail() {
		return this.examineDetail;
	}

	public void setExamineDetail(ExamineDetail examineDetail) {
		this.examineDetail = examineDetail;
	}

	@Override
	public String toString() {
		return this.getClass().getName() + "[ " + idMedicineDetail + " | " + dose + " | "
				+ medicineInfo.getIdMedicineInfo() + " | " + quantity + " ]";
	}
}